package com.project.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 供应商实体
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_factory")
public class Factory implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 供应商编号*/
    @TableId(value = "pk_factoryId", type = IdType.AUTO)
    private Integer factoryId;

    /** 名称*/
    @NotBlank(message = "供应商名称必须填")
    @Length(min = 2,max = 10,message = "供应商名称长度在2-10位之间")
    @TableField("f_name")
    private String name;

    /** 负责人*/
    @NotBlank(message = "负责人必须填写")
    @TableField("f_head")
    private String head;

    /** 负责人电话*/
    @NotBlank(message = "电话必须填写")
    @Pattern(regexp = "1[35789]\\d{9}",message = "电话必须是13、15、17、18、19开始的11位数")
    @TableField("f_headPhone")
    private String headPhone;

    /** 负责人地址*/
    @NotBlank(message = "负责人地址必须填写")
    @TableField("f_address")
    private String address;

    /** 经营范围*/
    @NotBlank(message = "经营范围必须填写")
    @TableField("f_scope")
    private String scope;



}
